package com.zcx.springcloud.payment8001.controller;

import com.zcx.springcloud.payment8001.entity.Payment;
import com.zcx.springcloud.payment8001.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/payment")
@CrossOrigin
@Slf4j
public class PaymentController  {

    @Resource
    private PaymentService paymentService;

    @GetMapping("/list")  // get请求不用加 @RequestBody 注解
    public Object test( Payment payment){

//        paymentService.create(payment);

        List<Payment> payments = paymentService.selectPaymentList(payment);
        System.out.println("size:="+payments.size());
        return "1";
    }

    @PostMapping("/add")
    public Object testInsert(@RequestBody Payment payment){

        int i = paymentService.create(payment);
        System.out.println("这是i:="+i);

//        List<Payment> payments = paymentService.selectPaymentList(payment);
//        System.out.println("size:="+payments.size());
        return "1";
    }
}
